package signal;

import sun.misc.Signal;

public class Test {

    /*
    * 监听ctrl-c ctrl-z 强行中断程序
    * */

    public static void main(String[] args) {
        reg_signal();
        Task task=new Task();
        task.run();
    }

    //注册信号
    static void reg_signal(){
        SignalManager manager=new SignalManager();
        Signal.handle(new Signal("TERM"),manager);
        Signal.handle(new Signal("INT"),manager);
    }

}
